<?php

namespace App\Http\Controllers\Backend;
use App\Http\Controllers\BaseController;
use App\Params\Backend\PayListParam;
use App\Params\Backend\PayUpdateParam;
use App\Services\Base\PayService;
use App\Traits\VerifyRequestParam;

/**
 * 支付方式管理控制器
 *
 * @package App\Http\Controllers\H5
 * @author WangBin
 * @date 2022-01/19
 */
class PayController extends BaseController
{
    use VerifyRequestParam;
    /**
     * 获取支付方式列表
     *
     * @throws
     * @return
     */
    public function getPayList()
    {
        $param = PayListParam::create();
        $ret = PayService::getInstance()->getList($param);
        return $this->success($ret);
    }

    /**
     * 更新支付方式
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function update()
    {
        $param = PayUpdateParam::create();
        $result = PayService::getInstance()->update($param);
        return $this->success($result);
    }

    /**
     * 获取支付方式
     *
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     */
    public function getInfo()
    {
        $id = $this->verifyInteger('pay_id');
        $result = PayService::getInstance()->getInfo($id);
        return $this->success($result);
    }
}
